//
//  THTieZICommentTableViewCell.m
//  TreeHole
//
//  Created by apple on 2020/9/19.
//  Copyright © 2020 stoneobs. All rights reserved.
//

#import "THBabyCommentTableViewCell.h"

@interface THBabyCommentTableViewCell()
@property(nonatomic, strong) STButton                     *iconButton;/**<  */
@property(nonatomic, strong) STLabel                     *nickLable;/**<  */
@property(nonatomic, strong) STLabel                     *timeLable;/**<  */
@property(nonatomic, strong) STLabel                     *content_Lable;/**<  */
@end
@implementation THBabyCommentTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self stoneobs_ui_configSubView];
    }
    return self;
}

#pragma mark --configSubView
- (void)stoneobs_ui_configSubView{
    __weak typeof(self) weakSelf =  self;
    
    
    ({
        STButton * stoneobs_ui_button = [[STButton alloc] initWithFrame:CGRectMake(10, 15, 40, 40)
                                                                  title:nil
                                                             titleColor:nil
                                                              titleFont:0
                                                           cornerRadius:20
                                                        backgroundColor:nil
                                                        backgroundImage:STFDRandomImageProvider.random_livegirl_image
                                                                  image:nil];
        [self.contentView addSubview:stoneobs_ui_button];
        self.iconButton = stoneobs_ui_button;
        __weak typeof(self) weakSelf =  self;
        [stoneobs_ui_button setClicAction:^(UIButton *sender) {
            [TMUtils goto_user_info_witdh_id:weakSelf.model.user_id];
        }];
        
        
    });

    
    ({
        STLabel * stoneobs_ui_label = [[STLabel alloc] initWithFrame:CGRectMake(self.iconButton.right + 10, self.iconButton.top+10, 200, 20)
                                                                text:@""
                                                           textColor:UIColor.blackColor
                                                                font:15
                                                         isSizetoFit:NO
                                                       textAlignment:NSTextAlignmentLeft];
        [self.contentView addSubview:stoneobs_ui_label];
        self.nickLable = stoneobs_ui_label;
        stoneobs_ui_label.font = [UIFont fontWithName:STONEOBS_UI_FONT_CU_NAME size:15];
    });
    
    ({
        STLabel * stoneobs_ui_label = [[STLabel alloc] initWithFrame:CGRectMake(self.nickLable.left, self.iconButton.bottom +10, UISCREEN_WIDTH -self.nickLable.left - 15 , 20)
                                                                text:@""
                                                           textColor:STONEOBS_UI_SECEND_TEXT_COLOR
                                                                font:13
                                                         isSizetoFit:NO
                                                       textAlignment:NSTextAlignmentLeft];
        [self.contentView addSubview:stoneobs_ui_label];
        self.content_Lable = stoneobs_ui_label;

    });
    
    
    ({
        STLabel * stoneobs_ui_label = [[STLabel alloc] initWithFrame:CGRectMake(self.iconButton.right + 10, self.nickLable.bottom +3, UISCREEN_WIDTH - 120, 20)
                                                                text:@"s"
                                                           textColor:STONEOBS_UI_THIRD_TEXT_COLOR
                                                                font:10
                                                         isSizetoFit:NO
                                                       textAlignment:NSTextAlignmentLeft];
        [self.contentView addSubview:stoneobs_ui_label];
        self.timeLable = stoneobs_ui_label;

    });
}
- (void)setModel:(THBabyCommentModel *)model{
    _model = model;
    [self.iconButton sd_setImageWithURL:model.header_img.mj_url forState:UIControlStateNormal];
    self.nickLable.text = model.name;
    self.content_Lable.text = model.evaluate;
    [NSString stoneobs_fun_lableAutoAdjustheightWithLabel:self.content_Lable];
    self.timeLable.text = model.created_at;
    self.timeLable.top = self.content_Lable.bottom + 10;
    model.cus_height = self.timeLable.bottom + 10;
    
}
@end
